﻿///******************************************************    
///	FileName: CompanyShow.js
///	Action: 会员公司页面JS处理文件
///	Copyright(c)  2004-2008 Sirius Studio
///	Writer: XFY
///	Create Date: 2008-12-17
///	Rewriter:
///	Rewrite Date:
///****************************************************** 
var rightIcon="../images/websen.gif"
var rightIcons="../../images/icon_nothing.gif";
var txtjbo=new  Array("ctl00_ContInfo_txtCompanyName","ctl00_ContInfo_txtCapital","ctl00_ContInfo_txtRegisterAddress","ctl00_ContInfo_txtDealinAdd","ctl00_ContInfo_txtPostalcode","ctl00_ContInfo_txtProduct","ctl00_ContInfo_txtStreet","ctl00_ContInfo_txtURL","ctl00_ContInfo_txtCorporate")

//得到焦点
for(var i=0;i<txtjbo.length;i++){ 
   $(txtjbo[i]).onfocus =function (){
      for (var j=0;j<txtjbo.length;j++){
         if (txtjbo[j]==event.srcElement.id){postobj(j);}
      }
   }
}

function postobj(num){
   obj = "txt"+num;
   document.getElementById(obj).innerHTML =Company[num];
}

function oo(){
   $("yc").style.display="none"
}

//失去焦点
for(var i=0;i<txtjbo.length;i++){ 
   $(txtjbo[i]).onblur =function (){
      for (var j=0;j<txtjbo.length;j++){
         if (txtjbo[j]==event.srcElement.id){postobjs(j);}
      }
   }
}

function postobjs(num){
   var obj="txt"+num;
   if ($(obj).innerHTML!=""){
      $(obj).innerHTML=""
   }else {
      $(obj).innerHTML=ok;
   }
 
}

//提交函数
$("ctl00_ContInfo_btnServer").onclick=function (){
   var  CompS=new Array()
   CompS[0]=CompanyShow(txtjbo[0],0,0)
   CompS[1]=CompanyShow(txtjbo[1],1,1)
   CompS[2]=CompanyShow(txtjbo[2],2,0)
   CompS[3]=CompanyShow(txtjbo[3],3,0)
   var flag=1;
   for (i=0;i<CompS.length;i++){
      if (CompS[i]==false){
         flag=0;
         break;
      } 
   } 
   if (flag==0){
      return false;
   }else {
      return true;
   }
}

//地区
function diqu(list){
   if (list.options[list.selectedIndex].value != "中国") {
      document.all.ctl00_ContInfo_province.selectedIndex = 0;
      document.all.ctl00_ContInfo_city.selectedIndex = 0;
      document.all.ctl00_ContInfo_county.selectedIndex = 0;
      document.all.ctl00_ContInfo_province.style.display = 'none';
      document.all.ctl00_ContInfo_city.style.display = 'none';
      document.all.ctl00_ContInfo_county.style.display = 'none';
   } else {
      document.all.ctl00_ContInfo_province.style.display = '';
      document.all.ctl00_ContInfo_city.style.display = '';
      document.all.ctl00_ContInfo_county.style.display = '';
   }
}
function StrCity()
{
    ctl00_ContInfo_country.options
}
//处理方法
function  CompanyShow(name,num,bernum){
   var obj="txt"+num
   if ($(name).value.replace(/\s/g,'')==""){
      $(obj).innerHTML=GsBc[num]
      return false;
   }else if(bernum==1){
      if (!isNumber($(txtjbo[num]).value.replace(/\s/g,''))) {
         $(obj).innerHTML="<font color=#FF0000>注册资本不是合法的数字或为空</font>";
         return false 
      }else{
         if (num==4){ 
            if (!isPostalCode ($(txtjbo[4]).value.replace(/\s/g,''))){
               $(obj).innerHTML =GsBc[11]
               return false
            } else{
               $(obj).innerHTML=ok;
               return true
            }
         } else{ 
            $(obj).innerHTML=ok;
            return true
         } 
      } 
   }else{
      $(obj).innerHTML=ok;
      return true
   }
}

//显示提示信息
var ok="<font color=#999999>输入符合规范</font>";
var title="<p>";
var titles="</p>"
var Company=new Array()
Company[0]=title+"请输入公司名称"+titles
Company[1]=title+"请输入注册资金"+titles
Company[2]=title+"请输入注册地址"+titles
Company[3]=title+"请输入主要经营地址"+titles
Company[4]=title+"请输入邮政编码"+titles
Company[5]=title+"请输入主营产品"+titles
Company[6]=title+"请输入具体详细地址"+titles
Company[7]=title+"请输入该网站的网址"+titles
Company[8]=title+"请输入法人代表"+titles

//公司信息 保存显示文字
var  GsBc=new Array(13);
GsBc[0]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>公司名不能为空</font>";
GsBc[1]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>注册资本不能为空</font>";
GsBc[2]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>注册地址不能为空</font>";
GsBc[3]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>主要经营地址不能为空</font>";
GsBc[4]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>邮政编码不能为空</font>";
GsBc[5]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>主营产品不能为空</font>";
GsBc[6]="<font></font>";
GsBc[7]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000> 街道地址不能为空</font>";
GsBc[8]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000> 公司网址不能为空</font>";
GsBc[9]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000> 法人代表不能为空</font>";
GsBc[10]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000> 公司简介不能为空</font>";
GsBc[11]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>请输入数字</font>";
GsBc[12]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>输入不符和规范</font>";
